﻿<link href="@Url.Content("~/content/activitie_detail.css")" rel="stylesheet" type="text/css"/>
<link href="@Url.Content("~/content/table_btn.css")" rel="stylesheet" type="text/css"/>

<!--[if lte IE 8]>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
<![endif]-->

<noscript>
    <link href="@Url.Content("~/content/activitie_create.css")" rel="stylesheet" type="text/css"/>
    <link href="@Url.Content("~/content/activitie_noscript.css")" rel="stylesheet" type="text/css"/>
</noscript>

@model PessMvc.Models.ArchivesModel

@{
    ViewBag.Title = "档案列表";
    
    bool hideArchiveDetails = false;
    hideArchiveDetails = Roles.IsUserInRole("ExpertJudge")
        && ViewBag.HideArchiveDetails != null
        && ViewBag.HideArchiveDetails == true;
}
@*@Html.Partial("_ActivityNavPartial",ViewData["ActivityID"])*@
@{
    string status="";
    if(Roles.IsUserInRole("ExpertJudge")){
         status=string.Format("（已评：{0}  /  总数：{1}）", Model.ReviewHistory.Count, Model.PageInfo.TotalItems);
    }
}
<h2 style="width:300px;">档案及评分<span style="font-size:12px;"> @status</span></h2>
@*<p>
 @Html.DisplayFor(model => Model.SingleOrDefault().Subject.Activity.Name)
</p>*@
<div id="operate" class="formSearch" style="width:600px;">
       @if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin")||Roles.IsUserInRole(Membership.GetUser().UserName,"CountyAdmin"))
       {
           if ((bool)ViewBag.IsArchiveModificationAllowed == true)
           {
             <div>@Html.ActionLink("新建", "Create", new {activityID=ViewData["ActivityID"]},null)</div>
           }
           
           if(Roles.IsUserInRole("Admin"))
           {
               using (Html.BeginForm("ImportReviewFeedbacks","Archive",FormMethod.Post)) 
               {
                   @Html.DropDownList("SubjectID")
                   <input type="submit" value="导入评审意见" />                    
               }
           }
       }
    @if(!hideArchiveDetails)
    {
       <div>@Html.ActionLink("导出档案清单", "ExportArchiveList", "Archive", new {activityID=ViewData["ActivityID"]},null)</div>

        
    }
    @using(Html.BeginForm("Index","Archive",FormMethod.Get)){
            @Html.Hidden("ActivityID",ViewData["ActivityID"])
            @Html.TextBox("KeyWord")
            <input type="submit" value="搜索" class="inputBtn" />
        }
</div>

@using(@Html.BeginForm("SetExpertGroup","Archive",FormMethod.Post)){    
<table id="fileList" class="oddTable">
    <tr>
        <th></th>
        <th class="thTitle">
            @PessResources.Archive.ProjectTitle
        </th>
        <th class="thSName">
            @PessResources.Archive.SerialNumber
        </th>
        <th class="thSName">
            @PessResources.Archive.SubjectName
        </th>
        <th class="thCName">
            @PessResources.Archive.CountyName
        </th>
        <th class="thTName">
            @PessResources.Archive.TeacherName
        </th>
        @*<th class="thLevel">
           @PessResources.Archive.GradeLevel
        </th>*@
        <th class="thSCName">
            @PessResources.Archive.SchoolName
        </th>
        <th style="width:65px">
            评委组
        </th>
        <th class="thAction" style="width:110px"></th>
    </tr>
@{int x = 0;}
@foreach (var item in Model.All) {
    <tr>
        <td>@Html.CheckBox("Archives["+x+"].IsSelected")
            @Html.Hidden("Archives["+x+"].ArchiveID",item.ID)
        </td>
        <td class="thTitle">
            @Html.DisplayFor(modelItem=>item.ProjectTitle)
        </td>
        <td class="thSName">
            @Html.DisplayFor(modelItem => item.SerialNumber)
        </td>
        <td class="thSName">
            @Html.DisplayFor(modelItem => item.Subject.Name)
        </td>
        <td class="thCName">
            @if(!hideArchiveDetails)
            {
                @Html.DisplayFor(modelItem => item.County.Name)
            }
        </td>
        <td class="thTName">
            @if(!hideArchiveDetails)
            {
                @Html.DisplayFor(modelItem => item.TeacherName)
            }
        </td>
        @*<td class="thLevel">
            @Html.DisplayFor(modelItem => item.GradeLevel)
        </td>*@
        <td class="thSCName">
            @if(!hideArchiveDetails)
            {
                @Html.DisplayFor(modelItem =>item.SchoolName)
            }
        </td>    
        <td>
            @if(!hideArchiveDetails)
            {
                if(item.ExpertGroup!=null){@item.ExpertGroup.Callsign}
            }
        </td>   
        <td class="thAction">
        @if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin")||Roles.IsUserInRole(Membership.GetUser().UserName,"CountyAdmin"))
        {
            @Html.ActionLink("删除", "Delete", new { id=item.ID })
            @Html.ActionLink("详细", "Details", new { id=item.ID }) 
        }
        @if(Roles.IsUserInRole(Membership.GetUser().UserName,"ExpertJudge"))
        {
            if(ViewBag.IsScoreInputAllowed)
            {
                @Html.ActionLink("评分", "Grade", new { archiveID=item.ID })
            }
            if (Model.ReviewHistory.Select(r => r.ArchiveID).Contains(item.ID)) 
            { @Html.Label("已评")}
            else
            {
                @Html.Label("未评")
            }
        }
        </td>
    </tr>
    {x = x + 1;}
}

</table>
if(Roles.IsUserInRole(Membership.GetUser().UserName,"Admin")){   
<div style="padding-top:20px">    <span>将档案分配到评委组：</span>

    @Html.DropDownList("ExpertGroupID",new SelectList(Model.ExpertGroups,"ID","Callsign"))

    @Html.Hidden("Page", Model.PageInfo.CurrentPage)
    <input type="submit" value="分配" class="asBtn" />
</div>
}
}

<div id="pageNum">@Html.PageLinks(Model.PageInfo,u=>Url.Action("Index","Archive",new {ActivityID=Model.ActivityID,SubjectID=Model.SubjectID,Keyword=Model.Keyword,Page=u}))</div>

